<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>幸运抽奖</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
            margin: 0;
        }
        .container {
            text-align: center;
            background-color: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            max-width: 90%;
            width: 400px;
        }
        h1 {
            margin-bottom: 20px;
            font-size: 24px;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            border: none;
            background-color: #007bff;
            color: #fff;
            border-radius: 5px;
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #0056b3;
        }
        .result {
            margin-top: 20px;
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }
        .contact {
            margin-top: 20px;
            font-size: 14px;
            color: #666;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>幸运抽奖</h1>
        <button onclick="startLottery()">点击抽奖</button>
        <div class="result" id="result"></div>
        <div class="contact">
            <p>领奖请联系</p>
            <p>电话：18013825017</p>
        </div>
    </div>

    <script>
        function startLottery() {
            // 奖品列表及概率
            const prizes = [
                { name: "体验课", probability: 0.4 }, // 40% 概率
                { name: "报课满减券", probability: 0.4 }, // 40% 概率
                { name: "笔记本", probability: 0.1 }, // 10% 概率
                { name: "2B铅笔", probability: 0.1 } // 10% 概率
            ];

            // 计算累计概率
            let cumulativeProbability = 0;
            const random = Math.random(); // 生成0-1之间的随机数

            for (let prize of prizes) {
                cumulativeProbability += prize.probability;
                if (random < cumulativeProbability) {
                    document.getElementById("result").innerText = `恭喜你抽中了：${prize.name}`;
                    break;
                }
            }
        }
    </script>
</body>
</html>